import request from "./axios.js";
/* 请求登录 */
export const getLogin = (payload) => {
  return request({
    url: "/api/login",
    method: "post",
    data: {
      username: payload.username,
      password: payload.password,
      type: payload.type,
    },
  });
};
/* 请求登出 */
export const getLogout = (payload) => {
  return request({
    url: "/api/logout",
    method: "post",
    data: {
      username: payload.username,
      type: payload.type,
    },
  });
};
/* 请求注册 */
export const getRegister = (payload) => {
  console.log(payload, 'register')
  return request({
    url: "api/register",
    method: "post",
    data: {
      username: payload.username,
      password: payload.password,
      type: payload.type,
    },
  });
};
/* 请求获取所有用户 */
export const getUserInfo = (type) => {
  return request({
    url: `/api/user?type=${type}`,
    method: "get",
  });
};
/* 请求删除用户 */
export const getDelete = (payload) => {
  console.log(payload, 'delete')
  return request({
    url: "/api/delete",
    method: "post",
    data: {
      username: payload.username,
      type: payload.type,
    },
  });
};
// 发布公告
export const sendNotice = (payload) => {
  return request({
    url: "/api/add/notice",
    method: "post",
    data: payload
  });
};
// 查看公告
export const getNotice = () => {
  return request({
    url: "/api/get/notice",
    method: "get"
  });
};